package com.odp.mapper;

import com.odp.entity.Comment;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CommentMapper {
    //点赞评论
    @Update("update t_comment set likes = likes + 1 where comment_id=#{commentId}")
    public int likeComment(int commentId);

    //评论
    public int makeComment(Comment comment);

    //有人回复层主，楼层表中未读数+1
    @Update("update t_comment set unread_num=unread_num+1 where comment_id=#{commentId}")
    public int reply4Comment(int commentId);

    //得到一个帖子的所有评论的comment_id
    public List<Comment> getAllCommentsFromPost(int postId);
}
